﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="add_staff.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Staff.add_staff" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<body>
    <% 
        string name = Request.QueryString["name"];
        string username = Request.QueryString["username"];
        string pass = Request.QueryString["pass"];
        string repass = Request.QueryString["repass"];
        string email = Request.QueryString["email"];
        string phone = Request.QueryString["phone"];
        string day = Request.QueryString["day"];
        string month = Request.QueryString["month"];
        string year = Request.QueryString["year"];
        int sex = int.Parse(Request.QueryString["sex"]);
        int role = int.Parse(Request.QueryString["role"]);
        string birthday = year + "-" + month + "-" + day;
        bool sex1 = true;
        if (sex == 0)
            sex1 = false;
        new TblManagerController().Insert(username, pass, role, name, DateTime.Parse(birthday), sex1, "logosqt.png", false, phone, email.ToLower(), "", null, false, "headerbanner.jpg", "");
        var staff = new TblManagerController().FetchAll().Last();
        var get_role = new TblManagerRoleController().FetchAll();
    %>
    <tr id="staff<%=staff.ManagerId %>" class="staff">
        <td class="w3-hide staff_id"><%=staff.ManagerId %></td>
        <td class="staff-img">
            <img src="../Content/avatar/<%=staff.Avatar %>" class="w3-circle" /></td>
        <td><%=staff.ManagerName %></td>
        <td>
            <select style="padding: 1.1%" class="change_role">
                <%
                    foreach (TblManagerRole role1 in get_role)
                    { %>
                <%if (staff.Role == role1.RoleId)
                  {%>
                <option value="<%=role1.RoleId %>" selected="selected"><%=role1.RoleName %></option>
                <%}
                  else
                  { %>
                <option value="<%=role1.RoleId %>"><%=role1.RoleName %></option>
                <%}
                      } %>
            </select>
        </td>
        <td><%=staff.FullName %></td>
        <td><%=DateTime.Parse(staff.Birthday.ToString()).Day+"/"+DateTime.Parse(staff.Birthday.ToString()).Month+"/"+DateTime.Parse(staff.Birthday.ToString()).Year %></td>
        <td><%if (staff.Sex == true)
              { %>Nam<%}
              else
              {%>Nữ<%} %></td>
        <td><%=staff.Phone %></td>
        <td><%=staff.Email %></td>
        <%if (staff.Active == true)
          {%>
        <td class="option-btn">
            <i class="on1 fa fa-toggle-on w3-text-teal w3-animate-opacity"></i>
        </td>
        <%}
          else
          { %>
        <td class="option-btn">
            <i class="on1 fa fa-toggle-on w3-text-red w3-animate-opacity fa-rotate-180 off "></i>
        </td>
        <%} %>
        <td class="option-btn"><i onclick="document.getElementById('xoanhanvien').style.display = 'block'" class="del_staff fa fa-trash"></i></td>
    </tr>
</body>
</html>
